﻿Imports System.Data
Imports VSModel
Imports Cls_Common
Imports SecurityService

Partial Class Control_MSDS_Section14View
    Inherits System.Web.UI.UserControl
	Private Shared ReadOnly log As log4net.ILog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType)
#Region "Sub and Function "
	Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Translate()
        If Not IsPostBack Then
            Dim script As ScriptManager = ScriptManager.GetCurrent(Me.Page)
            If Not script Is Nothing AndAlso script.IsInAsyncPostBack Then
                ScriptManager.RegisterStartupScript(Me.Page, Me.Page.GetType, "duyjs", "ajaxJquery()", True)
            Else
                Me.Page.ClientScript.RegisterStartupScript(Me.Page.GetType(), "duyjs", String.Concat("Sys.Application.add_load(function(){", "ajaxJquery()", "});"), True)
            End If

            hidMSDSID.Value = IIf(IsNothing(Request.QueryString("Id")), 0, CInt(Request.QueryString("Id")))
            ShowData()
        End If
	End Sub
	Protected Sub Translate()
		lblSection14Header.Text = getTranslate("lblSection14Header", Session("LanguageId"), lblSection14Header.Text)
		lblHeaderCol1.Text = getTranslate("lblHeaderCol1", Session("LanguageId"), lblHeaderCol1.Text)
		lblHeaderCol2.Text = getTranslate("lblHeaderCol2", Session("LanguageId"), lblHeaderCol2.Text)
		lblHeaderCol3.Text = getTranslate("lblHeaderCol3", Session("LanguageId"), lblHeaderCol3.Text)
		lblHeaderCol4.Text = getTranslate("lblHeaderCol4", Session("LanguageId"), lblHeaderCol4.Text)
		lblHeaderCol5.Text = getTranslate("lblHeaderCol5", Session("LanguageId"), lblHeaderCol5.Text)
		lblHeaderCol6.Text = getTranslate("lblHeaderCol6", Session("LanguageId"), lblHeaderCol6.Text)
		lblHeaderCol7.Text = getTranslate("lblHeaderCol7", Session("LanguageId"), lblHeaderCol7.Text)
	End Sub
	Protected Sub ShowData()
		Using data As New VSEntities
			'Tiêu đề doanh nghiệp
			Dim lang = CInt(Session("LanguageId"))
			Dim Id As Integer = hidMSDSID.Value
			Dim p As MSDSSection14 = (From a In data.MSDSSection14 Where a.MSDSId = Id And a.LanguageId = lang).SingleOrDefault
			If Not IsNothing(p) Then
                'Content
                txtS1411.Text = IIf(IsNothing(p.S1411) = True, "", p.S1411)
                txtS1412.Text = IIf(IsNothing(p.S1412) = True, "", p.S1412)
                txtS1413.Text = IIf(IsNothing(p.S1413) = True, "", p.S1413)
                txtS1414.Text = IIf(IsNothing(p.S1414) = True, "", p.S1414)
                txtS1415.Text = IIf(IsNothing(p.S1415) = True, "", p.S1415)
                txtS1416.Text = IIf(IsNothing(p.S1416) = True, "", p.S1416)
                txtS1421.Text = IIf(IsNothing(p.S1421) = True, "", p.S1421)
                txtS1422.Text = IIf(IsNothing(p.S1422) = True, "", p.S1422)
                txtS1423.Text = IIf(IsNothing(p.S1423) = True, "", p.S1423)
                txtS1424.Text = IIf(IsNothing(p.S1424) = True, "", p.S1424)
                txtS1425.Text = IIf(IsNothing(p.S1425) = True, "", p.S1425)
                txtS1426.Text = IIf(IsNothing(p.S1426) = True, "", p.S1426)
                txtS1431.Text = IIf(IsNothing(p.S1431) = True, "", p.S1431)
                txtS1432.Text = IIf(IsNothing(p.S1432) = True, "", p.S1432)
                txtS1433.Text = IIf(IsNothing(p.S1433) = True, "", p.S1433)
                txtS1434.Text = IIf(IsNothing(p.S1434) = True, "", p.S1434)
                txtS1435.Text = IIf(IsNothing(p.S1435) = True, "", p.S1435)
                txtS1436.Text = IIf(IsNothing(p.S1436) = True, "", p.S1436)
                If lang = 2 Then
                    lblSection14Row1.Text = ""
                    lblSection14Row2.Text = ""
                    lblSection14Row3.Text = ""
                End If

            End If
        End Using
	End Sub
#End Region
End Class
